<%@page import="domain.Contact"%>
<%@page import="domain.Company"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%>
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic"%>
<%@ taglib prefix="nested" uri="http://struts.apache.org/tags-nested"%>
<% Contact contact = (Contact) request.getAttribute("contact");
   String name = contact.getLastName().toUpperCase().concat(" ").concat(contact.getFirstName()); 
   String image = request.getContextPath().concat("/img/no_avatar.gif"); %>
<!DOCTYPE html> 
<html:html>
<head>
<title><%=name%></title>
<jsp:include page="/pages/header.jsp" />
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="span12">
				<div class="page-header">
					<h1>
						<%=name%>
					</h1>
				</div>
			</div>
		</div>
		<div class="row">
			<jsp:include page="/pages/navbar.jsp" />
			<div class="span3">
				<strong><%=name%></strong><br/><br/>
				<%=contact.getAddress().getStreet()%><br/>
				<%=contact.getAddress().getZip()%>, <%=contact.getAddress().getCity()%><br/>
				<%=contact.getAddress().getCountry()%>		
				<%if(contact instanceof Company){%><br/><br/><strong>N°SIRET : </strong><%=((Company)contact).getSIRET()%><%} %>		
			</div>
			<div class="span3">
			 	<bean:message key="numPhoneMobileLabel" />&nbsp;&nbsp;:&nbsp;<%for(domain.PhoneNumber phone : contact.getPhones()){
					if(phone.getPhoneKind().equals("numPhoneMobile")){
						%><%=phone.getPhoneNumber()%><%
								break;
					}
				}%>
				<br/><br/><bean:message key="numPhoneHomeLabel" />&nbsp;:&nbsp;<%for(domain.PhoneNumber phone : contact.getPhones()){
					if(phone.getPhoneKind().equals("numPhoneHome")){
						%><%=phone.getPhoneNumber()%><%
								break;
					}
				}%>
				<br/><br/><bean:message key="numPhoneDesktopLabel" />&nbsp;&nbsp;:&nbsp;<%for(domain.PhoneNumber phone : contact.getPhones()){
					if(phone.getPhoneKind().equals("numPhoneDesktop")){
						%><%=phone.getPhoneNumber()%><%
								break;
					}
				}%>
			</div>
			<div class="span2">
				<bean:message key="booksLabel" />&nbsp;:<br/><br/>
				<%for(domain.ContactGroup book : contact.getBooks()){
					%>- <%=book.getGroupName()%><br/><%
					}%>
			</div>
			<div class="span2">
				<html:img src="<%=image%>"/>
			</div>
		</div>
		<jsp:include page="/pages/footer.jsp" />
	</div>
</body>
</html:html>